/*
 * 础石AUTOSAR CP操作系统 -- 驱动子系统初始化
 *
 * Copyright (C) 2022 国科础石(重庆)软件有限公司
 *
 * 作者: Yongbo Zhang <zhangyongbo@kernelsoft.com>
 *
 * 基于linux/drivers/base/init.c
 * Copyright (c) 2002-3 Patrick Mochel
 * Copyright (c) 2002-3 Open Source Development Labs
 *
 * License terms: GNU General Public License (GPL) version 3
 *
 */

#include <dim-sum/device.h>
#include <dim-sum/devtree.h>
#include <dim-sum/init.h>
#include "base.h"

int __init classes_init(void)
{
	return 0;
}

int __init buses_init(void)
{
	return 0;
}


int __init driver_init(void)
{
	/* 核心部件
	 * tips:目前bus和class初始化均为空
	 */
	buses_init();
	classes_init();

	/**
	 * 也是核心部件，但是必须在上述核心部件之后
	 */
	platform_bus_init();
	return 0;
}

int __init customize_machine(void)
{
	#if 0
		struct device_node *node, *root;
		void  parse_early_options(const char *cmdline);
		int ret;
		const char *options;
		root = dt_find_node_by_path("/");
			for_each_child_of_node(node, root) {
				if (dt_read_string(node,
					DT_BOOTARGS_PROP_NAME, &options) == OK) {
					parse_early_options(options);
				}
				if (!dt_find_property(node, "compatible"))
					continue;
					ret = dt_platform_device_create(node);
				if (ret) {
					dt_node_loosen(node);
				}
			}
		dt_node_loosen(root);
	#endif
	return 0;
}

